package com.activitycode.adapter;

import java.util.List;

import com.activitycode.datamodel.modelinfo.SearchInfo;
import com.activitycode.util.CommConstant;
import com.helixinsoft.texi.driver.R;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;


public class SearchAdapter extends BaseAdapter{
	
	public Context context;
	private List<SearchInfo> infoList;
	private List<Integer> iconList;
	public final String Tag ="HistoryAdapter";
	public SearchAdapter adapter;
	private ImageLoader imageLoader;
	private DisplayImageOptions options;
	
	
	public SearchAdapter(Context ct,List<SearchInfo> list){
		this.context = ct;
		this.infoList = list;
		
		adapter = this;
	}
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return infoList.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return infoList.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		ViewHolder viewHolder = null;
		  
        if (convertView == null) {
            viewHolder = new ViewHolder();
            convertView = LayoutInflater.from(context).inflate(R.layout.adapter_search, null);
            viewHolder.name = (TextView) convertView.findViewById(R.id.adapter_search_name); 
            viewHolder.street = (TextView) convertView.findViewById(R.id.adapter_search_street); 
            
            convertView.setTag(viewHolder);
        } else {
        	
            viewHolder = (ViewHolder) convertView.getTag();
        }
        
       
        viewHolder.name.setText(infoList.get(position).name);
        viewHolder.street.setText(infoList.get(position).street);
       

        
		return convertView;
	}
	public final static class ViewHolder {
        TextView name,street;
        
        
    }
	

	
	
	

}